/*

Line and matrix header.

Greg Turk, November 1996

*/

#ifndef _MATH_LIB_H
#define _MATH_LIB_H


#define  XSIZE       1
#define  YSIZE       2
#define  ZSIZE       3
#define  MAX_SIZE    4
#define  DELTA_SIZE  5



typedef float gtMatrix[4][4];
typedef float gtVector[3];

typedef struct StackEntry {
	gtMatrix mat;
} StackEntry;

#define STACK_MAX 10

class gtSimulator
{
public:
	gtSimulator() : stack_top(0)
	{

	}
	void gtInitialize();
	void gtPushMatrix();
	void gtPopMatrix();
	void gtTranslate(float, float, float);
	void gtScale(float, float, float);
	void gtRotate(float angle, float ax, float ay, float az);
	void gtLookAt(float, float, float, float, float, float, float, float, float);
	void apply_current_transformation (gtVector v);
	void get_top_matrix(gtMatrix);
private:
	StackEntry stack[10];   /* the matrix stack */
	int stack_top;      /* stack[stack_top] is current trans. matrix */

	/* clipping planes */
	float znear;
	float zfar;
};




void apply_matrix(gtVector, gtMatrix);
void identity_matrix(gtMatrix);
void mult_matrix(gtMatrix, gtMatrix, gtMatrix);
void print_matrix(gtMatrix);
void copy_matrix(gtMatrix, gtMatrix);



#endif